\(\int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx\) [56]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 66 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=-\frac {\text {arctanh}(\cos (c+d x))}{a d}+\frac {b \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{a \sqrt {a^2+b^2} d} \]

[Out]

-arctanh(cos(d*x+c))/a/d+b*arctanh((b*cos(d*x+c)-a*sin(d*x+c))/(a^2+b^2)^(1/2))/a/d/(a^2+b^2)^(1/2)

Rubi [A] (verified)

Time = 0.17 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3599, 3189, 3855, 3153, 212} \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {b \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{a d \sqrt {a^2+b^2}}-\frac {\text {arctanh}(\cos (c+d x))}{a d} \]

[In]

Int[Csc[c + d*x]/(a + b*Tan[c + d*x]),x]

[Out]

-(ArcTanh[Cos[c + d*x]]/(a*d)) + (b*ArcTanh[(b*Cos[c + d*x] - a*Sin[c + d*x])/Sqrt[a^2 + b^2]])/(a*Sqrt[a^2 +
b^2]*d)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 3153

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Dist[-d^(-1), Subst[Int
[1/(a^2 + b^2 - x^2), x], x, b*Cos[c + d*x] - a*Sin[c + d*x]], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2,
0]

Rule 3189

Int[(cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.))/(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(
c_.) + (d_.)*(x_)]), x_Symbol] :> Int[ExpandTrig[cos[c + d*x]^m*(sin[c + d*x]^n/(a*cos[c + d*x] + b*sin[c + d*
x])), x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IntegersQ[m, n]

Rule 3599

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Sin[e + f*x]^
m*((a*Cos[e + f*x] + b*Sin[e + f*x])^n/Cos[e + f*x]^n), x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
 ILtQ[n, 0] && ((LtQ[m, 5] && GtQ[n, -4]) || (EqQ[m, 5] && EqQ[n, -1]))

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cot (c+d x)}{a \cos (c+d x)+b \sin (c+d x)} \, dx \\ & = \int \left (\frac {\csc (c+d x)}{a}-\frac {b}{a (a \cos (c+d x)+b \sin (c+d x))}\right ) \, dx \\ & = \frac {\int \csc (c+d x) \, dx}{a}-\frac {b \int \frac {1}{a \cos (c+d x)+b \sin (c+d x)} \, dx}{a} \\ & = -\frac {\text {arctanh}(\cos (c+d x))}{a d}+\frac {b \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (c+d x)-a \sin (c+d x)\right )}{a d} \\ & = -\frac {\text {arctanh}(\cos (c+d x))}{a d}+\frac {b \text {arctanh}\left (\frac {b \cos (c+d x)-a \sin (c+d x)}{\sqrt {a^2+b^2}}\right )}{a \sqrt {a^2+b^2} d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.14 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {-\frac {2 b \text {arctanh}\left (\frac {-b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d} \]

[In]

Integrate[Csc[c + d*x]/(a + b*Tan[c + d*x]),x]

[Out]

((-2*b*ArcTanh[(-b + a*Tan[(c + d*x)/2])/Sqrt[a^2 + b^2]])/Sqrt[a^2 + b^2] - Log[Cos[(c + d*x)/2]] + Log[Sin[(
c + d*x)/2]])/(a*d)

Maple [A] (verified)

Time = 0.75 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.95

method result size
derivativedivides \(\frac {\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 b \,\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{a \sqrt {a^{2}+b^{2}}}}{d}\) \(63\)
default \(\frac {\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 b \,\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{a \sqrt {a^{2}+b^{2}}}}{d}\) \(63\)
risch \(-\frac {i b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i b +a}{\sqrt {-a^{2}-b^{2}}}\right )}{\sqrt {-a^{2}-b^{2}}\, d a}+\frac {i b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i b +a}{\sqrt {-a^{2}-b^{2}}}\right )}{\sqrt {-a^{2}-b^{2}}\, d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a d}\) \(150\)

[In]

int(csc(d*x+c)/(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/a*ln(tan(1/2*d*x+1/2*c))-2*b/a/(a^2+b^2)^(1/2)*arctanh(1/2*(2*a*tan(1/2*d*x+1/2*c)-2*b)/(a^2+b^2)^(1/2)
))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 183 vs. \(2 (62) = 124\).

Time = 0.31 (sec) , antiderivative size = 183, normalized size of antiderivative = 2.77 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\sqrt {a^{2} + b^{2}} b \log \left (\frac {2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} - 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right ) - {\left (a^{2} + b^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left (a^{2} + b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, {\left (a^{3} + a b^{2}\right )} d} \]

[In]

integrate(csc(d*x+c)/(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(sqrt(a^2 + b^2)*b*log((2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 - 2*a^2 - b^2 - 2*sqr
t(a^2 + b^2)*(b*cos(d*x + c) - a*sin(d*x + c)))/(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2
+ b^2)) - (a^2 + b^2)*log(1/2*cos(d*x + c) + 1/2) + (a^2 + b^2)*log(-1/2*cos(d*x + c) + 1/2))/((a^3 + a*b^2)*d
)

Sympy [F]

\[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\int \frac {\csc {\left (c + d x \right )}}{a + b \tan {\left (c + d x \right )}}\, dx \]

[In]

integrate(csc(d*x+c)/(a+b*tan(d*x+c)),x)

[Out]

Integral(csc(c + d*x)/(a + b*tan(c + d*x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.52 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.62 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {b \log \left (\frac {b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}} a} + \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a}}{d} \]

[In]

integrate(csc(d*x+c)/(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

(b*log((b - a*sin(d*x + c)/(cos(d*x + c) + 1) + sqrt(a^2 + b^2))/(b - a*sin(d*x + c)/(cos(d*x + c) + 1) - sqrt
(a^2 + b^2)))/(sqrt(a^2 + b^2)*a) + log(sin(d*x + c)/(cos(d*x + c) + 1))/a)/d

Giac [A] (verification not implemented)

none

Time = 0.43 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.42 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {b \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}} a} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a}}{d} \]

[In]

integrate(csc(d*x+c)/(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

(b*log(abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b - 2*sqrt(a^2 + b^2))/abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b + 2*sqrt(a^2
 + b^2)))/(sqrt(a^2 + b^2)*a) + log(abs(tan(1/2*d*x + 1/2*c)))/a)/d

Mupad [B] (verification not implemented)

Time = 4.91 (sec) , antiderivative size = 174, normalized size of antiderivative = 2.64 \[ \int \frac {\csc (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{a\,d}-\frac {2\,b\,\mathrm {atanh}\left (\frac {\sqrt {a^2+b^2}\,\left (1{}\mathrm {i}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+2{}\mathrm {i}\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+4{}\mathrm {i}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2\right )}{b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,4{}\mathrm {i}+a\,b^2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}+a^2\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,3{}\mathrm {i}+a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^2+b^2\right )\,1{}\mathrm {i}}\right )}{a\,d\,\sqrt {a^2+b^2}} \]

[In]

int(1/(sin(c + d*x)*(a + b*tan(c + d*x))),x)

[Out]

log(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))/(a*d) - (2*b*atanh(((a^2 + b^2)^(1/2)*(a^2*sin(c/2 + (d*x)/2)*1i +
b^2*sin(c/2 + (d*x)/2)*4i + a*b*cos(c/2 + (d*x)/2)*2i))/(b^3*sin(c/2 + (d*x)/2)*4i + a*b^2*cos(c/2 + (d*x)/2)*
1i + a^2*b*sin(c/2 + (d*x)/2)*3i + a*cos(c/2 + (d*x)/2)*(a^2 + b^2)*1i)))/(a*d*(a^2 + b^2)^(1/2))